package Test;

public class Main {
    public static void main(String[] args) {
        //string构造器
        char[] ch1 = {'a', 'b', 'c'};
        String str1 = new String(ch1);
        System.out.println(str1);

        byte[] bt1 = {97,98,99,100};
        String str2 = new String(bt1);
        System.out.println(str2);

        //字符串常用方法
        String str3 = new String("hello world!");
        //1.遍历
        for (int i = 0; i < str3.length(); i++) {
            char ch = str3.charAt(i);
            System.out.print(ch);
        }
        System.out.println();
        //2.
        char[] ch2 = str3.toCharArray();
        for (int i = 0; i < str3.length(); i++) {
            System.out.print(ch2[i]);
        }
        System.out.println();
    }
}
